package ca.swank.hq.hard;

import ca.swank.hardquor.*;

import java.util.LinkedList;
import java.util.TreeSet;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Iterator;


/**
* A version of the hardquorSimpleBoard that has additions for UI board logic
*
* @author Jesse Wilson
* @version 1.0 10/18/2001
*/
public class UIBoard extends hardquorSimpleBoard
{
  TreeSet wallsPlaced;

  public UIBoard()
  { super();
    wallsPlaced = new TreeSet();
  }

  public UIBoard(hardquorSimpleBoard other)
  { super(other);
  }

  public UIBoard(int width, int height, int playerStartWalls)
  { super(width, height, playerStartWalls);
  }

  /** 
   * makes the move and adds the wall to the wall list
   */
  public void makeMove(int[] a1, int[] a2, int[] b1, int[] b2)
  { wallsPlaced.add(new WallMove(a1,a2,b1,b2));
    super.makeMove(a1, a2, b1, b2);
  }

  /** 
   * unmakes the move and removes the wall from the wall list
   */
  public void unMove(int[] a1, int[] a2, int[] b1, int[] b2)
  { wallsPlaced.remove(new WallMove(a1,a2,b1,b2));
    super.unMove(a1, a2, b1, b2);
  }

  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized TreeSet getWallsPlaced()
  { return wallsPlaced;
  }

  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized void makeMove(Move move)
  { super.makeMove(move);
  }

  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized int isLegalMove(Move move)
  { return super.isLegalMove(move);
  }

  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized int isLegalMove(WallMove move)
  { return super.isLegalMove(move);
  }

  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized int isLegalMove(WalkMove move)
  { return super.isLegalMove(move);
  }
  
  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized int getTurn()
  { return super.getTurn();
  }
  
  /** 
   * synchronized for UI access by network thread and UI thread
   */
  public synchronized int[] getPlayerLocation(int playerNumber)
  { return super.getPlayerLocation(playerNumber);
  }

}